
variable "rr" { type = string }
variable "value" { type = string }
variable "type" { type = string }

variable "status" {
  type = string
  default = "ENABLE"
}

variable "remark" {
  type = string
  default = ""
}

variable "ttl" {
  type = number
  default = 60
}

# to dynamically retrieve zone id from aliyun API
#
# data "alicloud_pvtz_zones" "deeproute_cn" {
#   keyword     = "deeproute.cn"
#   search_mode = "EXACT"
# }
#
# data.alicloud_pvtz_zones.deeproute_cn.zones.0.id

# using a hardcoded id to make one less api call as requests to aliyun
# api could be slow from our office network. :(
locals {
  alicloud_zone_id = "ed5ac8ffd35b17c4f0e60c587d647963"
  zone_name        = "deeproute.cn"
}

module "deeproute_cn" {
  source = "../../dns"

  alicloud_zone_id = local.alicloud_zone_id
  zone             = local.zone_name

  rr    = var.rr
  type  = var.type
  ttl   = var.ttl
  value = var.value
  remark = var.remark
  status = var.status
}
